package com.csu.client.module.messageProcess;


import com.csu.client.logger.EIMLogger;
import com.csu.client.module.vo.Cache;
import com.csu.message.BaseMessage;
import com.csu.message.CinemaResponseMessage;
import com.csu.message.MessageType;
import com.daohang361.imqq.ui.EIMTalkFrame;

public class CinemaResponseProcess implements IMessageProcess {

	public void processMessage(BaseMessage message) {
		EIMLogger.INFO(message);
		final CinemaResponseMessage responseMessage=(CinemaResponseMessage)message;
		
		 java.awt.EventQueue.invokeLater(new Runnable() {
				public void run() {
					String friendQQ=responseMessage.getSrcQQ();
					 String owerQQ=responseMessage.getDestQQ();
					 EIMLogger.INFO("friendQQ:"+friendQQ+" owerQQ:"+owerQQ);
					 EIMLogger.INFO("cinemaResponse():"+responseMessage.getCinemaResponse());
					 
					 Cache cache=Cache.getInstance();
					 EIMTalkFrame qqTalkFrame=cache.getTalkFrame(friendQQ);
					 if(!qqTalkFrame.isVisible()){
							qqTalkFrame.setVisible(true);
						}
					 if(responseMessage.getCinemaResponse()==MessageType.CinemaResponse_Accepted){
						 javax.swing.JOptionPane.showMessageDialog(qqTalkFrame,"你的好友接收了视频请求");
						 
//						 CinemaIPPort cinemaIPPortBean=new CinemaIPPort();
//						 
//						 cinemaIPPortBean.setGetMediaIP(responseMessage.getGetCinemaDataIP());
//						 cinemaIPPortBean.setSendMediaIP(InetAddressTool.getLocalIP());
//						 
//						 ClientSendCinemaProcess sendCinemaProcess=new ClientSendCinemaProcess(cinemaIPPortBean);
//						 sendCinemaProcess.setQqTalkFrame(qqTalkFrame);
//						 sendCinemaProcess.intimediaCapture();
////						 sendCinemaProcess.paly();
//						 Thread thread=new Thread(sendCinemaProcess);
//						 thread.start();
						 
					 }else{
						 qqTalkFrame.removeSendGetFileProcessPanle();
						 javax.swing.JOptionPane.showMessageDialog(qqTalkFrame,"你的好友拒绝视频请求");
					 }
					 EIMLogger.Error("SendCinemaDataIP:"+responseMessage.getGetCinemaDataIP());
					 EIMLogger.Error("CinemaDataPort:"+responseMessage.getGetCinemaDataPort());
				}
			});
	}

}
